package com.naughty.shopapi.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class OrderFlake {

    public static String get0rderNO() {
        String dateString = getDate(new Date(), "yyMMdd");
        final String snowFlaks = new SnowFlake(0, 21).createOrderNo();
        String orderNo = dateString + snowFlaks;
        return orderNo;
    }
    public static String getDate(Date date, String format) {
        if (date == null) {
            return "";
        }
        SimpleDateFormat sdFormat = new SimpleDateFormat(format);
        return sdFormat.format(date);
    }
}
